home *** CD-ROM | disk | FTP | other *** search
- {
- File: KeyMapTst.p
-
- Contains:
-
- Written by: Cameron Birse
-
- Copyright: Copyright © 1984-1999 by Apple Computer, Inc., All Rights Reserved.
-
- You may incorporate this Apple sample source code into your program(s) without
- restriction. This Apple sample source code has been provided "AS IS" and the
- responsibility for its operation is yours. You are not permitted to redistribute
- this Apple sample source code as "Apple sample source code" after having made
- changes. If you're going to re-distribute the source, we require that you make
- it clear in the source that the code was descended from Apple sample source
- code, but that you've made changes.
-
- Change History (most recent first):
- 8/6/1999 Karl Groethe Updated for Metrowerks Codewarror Pro 2.1
-
-
-
- }
- PROGRAM KeyMapTst;
- {$load KeyLoad}
- uses Memory,QuickDraw,Events,Windows;
-
-
- VAR
- i,x,y : Integer;
- myKeyMap,oldKeyMap : KeyMap;
- quit,yes : boolean;
- MyRect : rect;
-
-
- {------------------------------------------------------------------------------------}
- {
- FUNCTION SysEnvirons(versionRequested: INTEGER; VAR theWorld: SysEnvRec): OSErr;
-
- INLINE $205f,$301f, $A090, $3e80;
-
- PROCEDURE ShutDwnStart;
- INLINE $3F3C,$0002,$A895;
-
- }
- {------------------------------------------------------------------------------------}
-
-
- BEGIN {main PROGRAM}
- InitGraf(@qd.thePort); {initialize QuickDraw}
- FlushEvents(everyEvent, 0); {call OS Event Mgr to discard any previous events}
- InitWindows; {initialize Window Manager}
- InitCursor; {call QuickDraw to make cursor (pointer) an arrow}
-
- {PROCEDURE WWInit(numLines, numCharsPerLine: INTEGER);}
-
- {WWInit(25,65); initialize WritelnWindow with default window}
-
- {PROCEDURE WWNew(bounds: Rect; windowTitle: Str255; goAway: BOOLEAN; visible: BOOLEAN;
- outputFont, outputSize: INTEGER);}
-
- Myrect.top := qd.ScreenBits.bounds.top+40;
- Myrect.left := qd.ScreenBits.bounds.left+4;
- Myrect.bottom := qd.ScreenBits.bounds.bottom-4;
- Myrect.right := qd.ScreenBits.bounds.right-4;
-
- //WWNew(MyRect, 'A Window, eh?', true, true, 1,9);
-
-
- quit := false;
- yes := false;
- writeln ('KeyMap :');
- for i := 0 to 127 do
- begin
- if myKeyMap[i] then write('1')
- else write('0');
- if i = 63 then writeln ('');
- oldKeyMap[i] := myKeyMap[i];
- if button then quit := true;
- end;
- writeln ('');
- repeat
- if button then quit := true;
- GetKeys (myKeyMap);
- for x := 0 to 127 do
- begin
- if myKeyMap[x] <> oldKeyMap[x] then
- begin
- yes := true;
- y := x;
- end;
- end;
- if yes then
- begin
- writeln ('Bit # ',y,' changed, KeyMap =');
- yes := false;
- for i := 0 to 127 do
- begin
- if myKeyMap[i] then write('1')
- else write('0');
- if i = 63 then writeln ('');
- oldKeyMap[i] := myKeyMap[i];
- if button then quit := true;
- end;
- writeln (' end');
- end;
- until quit;
-
- END.